home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Networking / OTCheckNetForNBPName / OTCheckNetForName Readme < prev    next >
Encoding:
Text File  |  2000-09-28  |  4.0 KB  |  61 lines  |  [TEXT/ttxt]

  1. OTCheckNetForNBPName
  2. Version: 1.0b1
  3.  
  4. A program sample demonstrating how to search an AppleTalk network with multiple zones for a reigstered Name Binding Protocol entity.
  5.  
  6. Description
  7.  
  8. The OTCheckNetForNBPName sample demonstrates the use of the Open Transport to search an AppleTalk network for an NBP entity using multiple simultaneous searches to reduce the lookup time.
  9.  
  10. This sample demonstrates how to
  11. 1. find the number of AppleTalk zones present by dynamically increasing the buffer size until a kOTBufferOverflowErr is no longer returned.
  12. 2. Use multiple lookup request and reply structures in order to reduce the amount of time required to search the network.
  13. 3. Use asynchronous lookup requests so that other actions can be taken while performing the lookup.
  14. 4. Turn on self send globally
  15. 5. Register/deregister an entity with OT.
  16.  
  17. The sample first determines the number of zones that will need to be searched. The gZoneBufPtr global is then allocated which is a pointer to a string array. Once we have found all of the zone names, the zone names are unpacked into the string array.
  18.  
  19. The program then allocates 3 large arrays with the number of elements governed by the GetNumberOfActiveLookups call.  There is a separate array for the lookup request, the lookup reply, and the entity array where the requested string and the response will be placed into. Initally all lookups are issued one after the other. As each lookup completes, in the NBPHandler code, then the lookup and reply structures are reused to issue the next lookup in the next zone in the zone list array. This process continues until all of the zones are checked.
  20.  
  21.  
  22. Building the Code
  23.  
  24. This sample was built using the Metrowerks CodeWarrior Pro IDE 3.2 environment and the Open Transport 2.0.3 SDK interfaces and libraries.
  25.  
  26. To rebuild the project, open it in CodeWarrior, change the access path as appropriate to point to the Open Tpt Client Developer folder in the OT 1.1.2 (or newer) SDK, and choose Make from the Project menu. Note that there are the following routines for you to change the behavior of the code.
  27.  
  28. OSStatus     SetNameMatchString(Str32 *matchString);
  29. OSStatus     SetTypeMatchString(Str32 *matchString);
  30. Use these routines to return Pascal strings with the NBP name and type  that you are interested in searching for
  31.  
  32. OSStatus SetNameRegisterString(Str32 *registerString)
  33. OSStatus SetTypeRegisterString(Str32 *registerString)
  34. Modify these routines to obtain the strings that you will use to register your NBP entity.
  35.  
  36. UInt32 GetNumberOfEntitiesPerZone(void)
  37. Returns the number of maximum number of entities that you will allow for a match per zone. For example, you might set the name to be a wildcard value but key on the type value.  As such, you might want to only allow 2 copies of the type to be present in the zone before the lookup returns.
  38.  
  39. GetNumberOfActiveLookups
  40. Returns the number of simultaneous lookups to handle at a time.  As you increase this value, you increase the lookup requests on the network and the amount of memory required using the OTAllocMem call for the lookup request and reply structures, as well, as for the entity structure.
  41.  
  42.  
  43. Limitations:
  44.  
  45. This sample was built using the OT 2.0.3 DDK.  It has not been tested with any earlier releases of Open Transport, but it should work to OT 1.1.2 at least.
  46.  
  47. Copyright (work in progress)  Apple Computer, Inc 
  48.  
  49. You may incorporate this sample code into your applications without restriction, though the sample code has been provided "AS IS" and the responsibility for its operation is 100% yours.  However, what you are not permitted to do is to redistribute the source as "DSC Sample Code"
  50. after having made changes. If you're going to re-distribute the source, we require that you make it clear in the source that the code was descended from Apple Sample Code, but that you've made changes.
  51.  
  52.  
  53. Bug Reports:
  54.  
  55. If you find any bugs, please send them to "devsupport@apple.com" and include "Attn: Rich Kubota" and I will try to address them.
  56.  
  57. Rich Kubota
  58. Apple Macintosh Developer Technical Support
  59. rkubota@apple.com
  60. 10/25/99
  61.